package businesslogic.studentbl;
import java.util.ArrayList;

import presentation.mainui.MainUI;

import vo.CourseVO;
import vo.StudentVO;
import vo.TeacherVO;
import businesslogicservice.studentblservice.*;
public class StudentDeal implements StudentBLService{
	public boolean addStudent(String ID, String name, long aID){
		MainUI.rmi.sendMessage("addStudent "+ID+" "+name+" "+aID);
		return true;
}
	  
	  public StudentVO showStudent(String ID){
		  MainUI.rmi.sendMessage("showStudentwithID"+" "+ID);
		  String studentinfo=MainUI.rmi.getMessage();
		  String[] split=studentinfo.split(" ");
		  StudentVO student=new StudentVO(split[0],split[1],Long.parseLong(split[2]),null);
		  return student;
}
	  
	  public ArrayList<StudentVO> showStudent() {
	 MainUI.rmi.sendMessage("showStudent");
	 String info=MainUI.rmi.getMessage();
	 if(info.equals("null"))
		 return null;
	 String[] split=info.split(";");
	 ArrayList<StudentVO> list=new ArrayList<StudentVO>();
	 for(int i=0;i<=split.length-1;i++){
		 String[] split2=split[i].split(" ");
		 StudentVO student=new StudentVO(split2[0],split2[1],Long.parseLong(split2[2]),null);
		 list.add(student);
	 }
	 return list;
}
	  
	  public ArrayList<StudentVO> showStudent(TeacherVO teacher){
		  return null;
}
	  
	  public ArrayList<StudentVO> showStudent(CourseVO course){
		  return null;
}
	  
	  public boolean endStudent(){
	  return true;
	}
}
